import {App,} from 'vue';
import {
    ElButton,
    ElMessage,
    ElNotification,
    ElMessageBox,
    ElMenu,
    ElMenuItem,
    ElSubMenu,
    ElBreadcrumb,
    ElBreadcrumbItem,
    ElRow,
    ElCol,
    ElTooltip,
    ElDropdown,
    ElDropdownMenu,
    ElDropdownItem
} from 'element-plus';
import 'element-plus/dist/index.css';
import 'dayjs/locale/zh-cn';
import { OptionProps } from 'element-plus/es/components/select-v2/src/defaults';
export type Size = 'default'|'medium'|'small'|'mini';
import lang from 'element-plus/lib/locale/lang/zh-cn';
interface ElementOptions{
    size:Size
}
export default (app:App,options:ElementOptions):void=>{
    const components=[
        ElButton,
        ElMessage,
        ElNotification,
        ElMessageBox,
        ElMenu,
        ElMenuItem,
        ElSubMenu,
        ElRow,
        ElCol,
        ElBreadcrumb,
        ElBreadcrumbItem,
        ElTooltip,
        ElDropdown,
        ElDropdownMenu,
        ElDropdownItem
    ]
    
    components.forEach(component =>{
        app.use(component)
    })
    
    // Vue.prototype 替换成config.globalProperties
    app.config.globalProperties.$message =  ElMessage
    app.config.globalProperties.$notify =   ElNotification
    app.config.globalProperties.$confirm =  ElMessageBox.confirm
    app.config.globalProperties.$alert =  ElMessageBox.alert
    app.config.globalProperties.$prompt =  ElMessageBox.prompt
    
    // element-plus 全局配置
    // 该对象目前支持size 与zindex 字段 size 用于改变组件的默认尺寸 small，zIndex 设置弹框的初始 z-index（默认值：2000）。
    app.config.globalProperties.$ELEMENT ={
        size:options.size,
        // zIndex:2000 弹窗zIndex默认值是2000
    }
}
